#include "physics/MaterialPhysics.h"
#include "PxMaterial.h"


using namespace Boon;


Boon::MaterialPhysics::MaterialPhysics( physx::PxMaterial* mat, float damping, float dampingAngular )
	: m_Mat( mat ), m_Damping( .0f ), m_DampingAngular( .0f )
{

}

Boon::MaterialPhysics::MaterialPhysics( const MaterialPhysics& o )
	: m_Mat( o.m_Mat ), m_Damping( o.m_Damping ), m_DampingAngular( o.m_DampingAngular )
{

}

void Boon::MaterialPhysics::SetDynamicFriction( float friction )
{
	m_Mat->setDynamicFriction( friction );
}

float Boon::MaterialPhysics::GetDynamicFriction() const
{
	return m_Mat->getDynamicFriction();
}

void Boon::MaterialPhysics::SetStaticFriction( float friction )
{
	m_Mat->setStaticFriction( friction );
}

float Boon::MaterialPhysics::GetStaticFriction() const
{
	return m_Mat->getStaticFriction();
}

void Boon::MaterialPhysics::SetRestitution( float restitution )
{
	m_Mat->setRestitution( restitution );
}

float Boon::MaterialPhysics::GetRestitution() const
{
	return m_Mat->getRestitution();
}

void Boon::MaterialPhysics::SetFrictionCombineMode( PhysicsCombineMode mode )
{
	m_Mat->setFrictionCombineMode( (physx::PxCombineMode::Enum)mode );
}

Boon::PhysicsCombineMode Boon::MaterialPhysics::GetFrictionCombineMode() const
{
	return (Boon::PhysicsCombineMode)m_Mat->getFrictionCombineMode();
}

void Boon::MaterialPhysics::SetRestitutionCombineMode( PhysicsCombineMode mode )
{
	m_Mat->setRestitutionCombineMode( (physx::PxCombineMode::Enum)mode );
}

Boon::PhysicsCombineMode Boon::MaterialPhysics::GetRestitutionCombineMode() const
{
	return (Boon::PhysicsCombineMode)m_Mat->getRestitutionCombineMode();
}

void Boon::MaterialPhysics::SetDamping( float damping )
{
	if( damping >= 0 )
		m_Damping = damping;
}

float Boon::MaterialPhysics::GetDamping() const
{
	return m_Damping;
}

void Boon::MaterialPhysics::SetDampingAngular( float damping )
{
	if( damping >= 0 )
		m_DampingAngular = damping;
}

float Boon::MaterialPhysics::GetDampingAngular() const
{
	return m_DampingAngular;
}

MaterialPhysics& Boon::MaterialPhysics::operator=( const MaterialPhysics& rhs )
{
	m_Mat = rhs.m_Mat;
	m_Damping = rhs.m_Damping;
	m_DampingAngular = rhs.m_DampingAngular;
	return *this;
}

